package ray.mgocc.title;

import ray.mgocc.Time;
import ray.mgocc.RuleScore;

public class Eagle extends WeekTitle{

    public final static double KILL_RATIO_THRESHOLD = 1.3;
    public final static double HEADSHOT_RATIO_THRESHOLD = 0.3;
    public int getPlayTimeThreshold(){ return 5;}
    public int getPriority(){ return 7; }
    public void init(){
        super.init();
        addKillRequirement(KILL_RATIO_THRESHOLD);
        add(new HeadShotRequirement());
    }

    class HeadShotRequirement extends Requirement{
        public String getName(){ return "hs"; }
        public double getHeadShotRatio(){
            final String KEY = "Total.";
            int all = getValue(KEY+"ALL.KILLS")+getValue(KEY+"ALL.STUNS");
            int hs = getValue(KEY+"HS.KILLS")+getValue(KEY+"HS.STUNS");
            double hsratio = ((double)hs)/all;
            return hsratio;
        }
        private double getThreshold(){
            return HEADSHOT_RATIO_THRESHOLD;
        }
        public double getRatio(){
            return getHeadShotRatio()/getThreshold();
        }
        public String toString(){
            return super.toString()+"("+getThreshold()+"<="+format(getHeadShotRatio())+")";
        }
    }
}
